|
1
|
|
|
import { StaticQuery, graphql } from "gatsby" |
|
2
|
|
|
import PropTypes from "prop-types" |
|
3
|
|
|
import React from "react" |
|
4
|
|
|
import { Helmet } from "react-helmet" |
|
5
|
|
|
|
|
6
|
|
|
import defaultOgImage from "../images/preseason.jpg" |
|
7
|
|
|
|
|
8
|
|
|
// function SEO({ description, lang, meta, keywords, title }) { |
|
9
|
|
|
function SEO({ lang, title, description, meta, keywords, path, image: metaImage }) { |
|
10
|
|
|
return ( |
|
11
|
|
|
<StaticQuery |
|
12
|
|
|
query={detailsQuery} |
|
13
|
|
|
render={({ site }) => { |
|
14
|
|
|
const metaDescription = description || site.siteMetadata.description |
|
15
|
|
|
const canonicalUrl = path ? `${site.siteMetadata.siteUrl}${path}` : null |
|
16
|
|
|
|
|
17
|
|
|
return ( |
|
18
|
|
|
<Helmet |
|
19
|
|
|
htmlAttributes={{ |
|
20
|
|
|
lang, |
|
21
|
|
|
}} |
|
22
|
|
|
title={title} |
|
23
|
|
|
titleTemplate={`%s | ${site.siteMetadata.title}`} |
|
24
|
|
|
link={canonicalUrl ? [{ rel: `canonical`, href: canonicalUrl }] : []} |
|
25
|
|
|
meta={ |
|
26
|
|
|
.concat(meta)} |
|
27
|
|
|
/> |
|
28
|
|
|
) |
|
29
|
|
|
}} |
|
30
|
|
|
/> |
|
31
|
|
|
) |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
SEO.defaultProps = { |
|
36
|
|
|
lang: `nl-BE`, |
|
37
|
|
|
meta: [], |
|
38
|
|
|
keywords: [], |
|
39
|
|
|
path: `/`, |
|
40
|
|
|
image: { |
|
41
|
|
|
src: defaultOgImage, |
|
42
|
|
|
width: 2000, |
|
43
|
|
|
height: 1000, |
|
44
|
|
|
}, |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
SEO.propTypes = { |
|
48
|
|
|
subtitle: PropTypes.string, |
|
49
|
|
|
description: PropTypes.string, |
|
50
|
|
|
lang: PropTypes.string, |
|
51
|
|
|
meta: PropTypes.array, |
|
52
|
|
|
keywords: PropTypes.arrayOf(PropTypes.string), |
|
53
|
|
|
title: PropTypes.string.isRequired, |
|
54
|
|
|
path: PropTypes.string, |
|
55
|
|
|
image: PropTypes.shape({ |
|
56
|
|
|
src: PropTypes.string.isRequired, |
|
57
|
|
|
height: PropTypes.number.isRequired, |
|
58
|
|
|
width: PropTypes.number.isRequired, |
|
59
|
|
|
}), |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
export default SEO |
|
63
|
|
|
|
|
64
|
|
|
const detailsQuery = graphql` |
|
65
|
|
|
query DefaultSEOQuery { |
|
66
|
|
|
site { |
|
67
|
|
|
siteMetadata { |
|
68
|
|
|
title |
|
69
|
|
|
subTitle |
|
70
|
|
|
description |
|
71
|
|
|
author |
|
72
|
|
|
siteUrl |
|
73
|
|
|
fbAppId |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
` |
|
78
|
|
|
|